/*
 * @Description: 数据项管理
 */
import request from '@/utils/request'
export default {
    /**
     * @description: rtu查数据项
     * @param {String/Number} rtuId
     */
    queryDataItemByRtu(rtuId) {
        return request.get(`/v3/iot/iotPlatform/queryDataItemByRtu?rtuId=${rtuId}`)
    },
    /**
     * @description: 组织编号查rtu
     * @param {String} companyMark
    */
    queryRtuByCompanyMark(companyMark) {
        return request.get(`/v3/iot/iotPlatform/queryRtuByCompanyMark?companyMark=${companyMark}`)
    },
    /**
     * @description: 获取所有数据项列表 *代表必填
     * @param {String/Number} page
     * @param {String/Number} size
     */
    getDataItemByList(companyMark) {
        return request.get(`/v3/iot/iotPlatform/queryDataItemByCompanyMark?companyMark=${companyMark}`)
    },

    /**
     * @description: 获取列表 *代表必填
     * @param {Object}  *
     */
    dataItemlist(params) {
        return request.post('/v3/iot/dataItem/queryPageList', {
            page: params.page,
            size: params.size,
            entity: params.entity
        });
    },
    /**
     * @description: 查询气象站
     * @param null *
     * @return {Object}
     */
    getMeteorologicalByCondition() {
        return request.get("/v3/iot/iotPlatform/rtu/queryMeteorologicalRtuList", {
            organizationNo: sessionStorage.organizationNo
        });
    },
    /**
     * @description: 查询气象站
     * @param null *
     * @return {Object}
     */
    getRtuByCondition(params) {
        return request.get(`/v3/iot/iotPlatform/dataItem/queryByRtuId?rtuId=${params}`);
    },
    /**
     * @description: 批量
     * @param {Object}  *
     */
    addFarmingTypelist(params) {
        return request.post('/v3/iot/dataItem/add', params);
        // return request.post('/base/farmingType/add', params);
    },
    /**
    * @description: 批量
    * @param {Object}  *
    */
    editFarmingTypelist(params) {
        return request.post('/v3/iot/dataItem/edit', params);
        // return request.post('/base/farmingType/add', params);
    },
    /**
     * @description: 批量删除
     * @param {Object}  *
     */
    delFarmingTypelist(params) {
        return request.get(`/v3/iot/dataItem/del?dataItemId=${params}&organizationNo=${sessionStorage.organizationNo}`);
    },
    /**
     * @description: 批量删除
     * @param {Object}  *
     */
    delListFarmingTypelist(params) {
        return request.post(`/v3/iot/dataItem/delList`, { ...params, organizationNo: sessionStorage.organizationNo });
    },
    /**
     * @description: 通过农场id查询农场所拥有的农业类型
     * @param {Object}  *
     */
    queryCondFarmingTypelist() {
        return request.post('/v3/organization/base/farmingType/queryByCondition', {
            // "companyId": localStorage.companyId
            organizationNo: sessionStorage.organizationNo
        });
    }
};
